home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 245 / mag3 / read.me < prev   
Text File  |  1988-10-10  |  6KB  |  129 lines

  1.  
  2.   Some comments on BLIT.PRG, MAG1.PRG, and MAG2.BAS
  3.             designed by Thomas H. Likens
  4.                       6/25/88 
  5.  
  6.  
  7. These three programs are examples of how to combine GFA 
  8. Basic programs with machine language.  
  9.  
  10. >>>>>>     IMPORTANT!!!... ACCOLADES  DEPT.    <<<<<<<<<
  11. _________________________________________________________________
  12.  
  13. None of these programs would have been possible without
  14. the excellent material provided by Frank Ostrowski (the
  15. author of GFA Basic) in his tutorial the GFA Basic Book.
  16.  
  17. I wanted to test the interfacing of machine language with 
  18. GFA Basic, for the purpose of creating a medium resolution 
  19. magnifying routine.  To successfully accomplish this I needed
  20. an interesting visual pattern to magnify.  Frank Ostrowski's 
  21. book provided an exellent design, simple to create and yet 
  22. visually exciting, using the XOR logical operator.  I 
  23. incorporated this design, with minimal changes, into my 
  24. programs and believe that credit should be given where 
  25. credit is due. If you want to program in GFA Basic 
  26. Frank Ostrowski's book is a 'must have' item!!!
  27. _____________________________________________________________________
  28.  
  29. Now onward... 
  30.  
  31. Essentially, these programs use the GFA Get command to obtain
  32. a bitmap approximately 64 pixels wide x 50 pixels tall.
  33.  
  34. Then the starting address of the Get string is obtained by
  35. the Varptr command (along with certain other documented
  36. parameters) and passed to a machine language program.  The 
  37. machine language program is stored as data statements in the GFA
  38. program so that the maximum possible speed could be achieved.
  39.  
  40. The main problem I had, ironically enough, was accessing the
  41. data stored by the Get command.  The actual data starts after
  42. you add 6(six) to the address returned by the Varptr command.
  43. Fair enough this is documented so I expected it.  What I could
  44. not find documented (at least clearly enough to understand) is 
  45. that after every 16 bytes stored by the Get command it then
  46. stores 4 null bytes.  I spend over two hours chasing down this
  47. little tidbit of information.  Oh well, such are the 
  48. fortunes of war.  Anyway I hope this saves you some time if you
  49. ever use the Get command in a similar fashion.
  50.  
  51. The first program is a custom blitter routine to augment
  52. the GFA PUT Command.  The machine language source code is
  53. included under the name Blit.S.  If you look closely at the                     GFA routine, you will notice a slight distortion of the image.  
  54. The machine language routine eliminates this distortion.
  55. I converted the machine language routine into data statements
  56. using a variation of a program included by Frank Ostrowski on 
  57. pp. 95-96 of his GFA Basic Book.  When using this program pay
  58. special attention to whether you assemble your programs PC-Relative
  59. or relocatable.
  60.  
  61. I passed the parameters to the assembly language routine 
  62. through the GFA command Void C:prg_address%().  Even though
  63. this command was intended to run compiled C programs from GFA I found
  64. it easier to work with then the Call command.  The way the stack
  65. accepts these variables is as follows:
  66.    EXAMPLE 1:  Void C:prg_address%(45,99,82,212)
  67. The STACK...
  68.    |________________|
  69.    |________________|
  70.    |______ 1 _______|
  71.    |______212_______| 
  72.    |_______82_______|
  73.    |_______99_______|
  74.    |_______45_______|
  75.  ?>|_____Random__#__| I'm not sure what this is.
  76.    |______ 1 _______| < Stack Pointer  
  77.  
  78. EXAMPLE 2:   Void C:prg_address%(L:45,L:99,L:82,58,212)
  79.  
  80.           NOTE: The 'L:' in front of the number means that you are
  81. passing a longword (32 bits) to the assembly program.  The default
  82. setting for passing parameters is a word (16 bits).
  83.  
  84. The STACK...
  85.    |________________|
  86.    |______ 1 _______|
  87.    |______212_______|
  88.    |_______58_______| 
  89.    |_______82_______|
  90.    |________0_______|
  91.    |_______99_______|
  92.    |________0_______|
  93.    |_______45_______|
  94.    |________0_______|
  95.  ?>|____Random_#____|
  96.    |______ 1 _______| < Stack Pointer
  97.  
  98. The second and third programs are medium resolution magnifying 
  99. routines.  Since bit manipulation can be accomplished much more
  100. readily in assembly than any high level language, the actual 
  101. magnifying of the image was done with machine language and 
  102. combined with GFA.  The program MAG1 is basically a driver 
  103. program.  It is very similar to the Blitter program.  Mag2 is 
  104. slightly more sophisticated employing the technique of page flipping
  105. to give the animation a smoother look.  I would have compiled MAG2
  106. also but I am using an older version of the GFA Compiler
  107. and I cannot get it to compile correctly.  The compiled program wants
  108. to change to low resolution once the Xbios(5) [Set_screen] call
  109. is made.  I suspect it is substituting something else besides -1
  110. into the resolution parameter.  Therefore you will need GFA Basic or
  111. its Run-only module to use this program.  
  112.  
  113. The unarced file should contain:
  114.  
  115.             BLIT.BAS   > GFA source code
  116.             BLIT.PRG   > Compiled GFA Blitter
  117.             BLIT.S     > The machine language source code
  118.                          for the Blitter routine
  119.             MAG1.BAS   > GFA source code
  120.             MAG1.PRG   > Compiled prg.
  121.             MAG2.BAS   > GFA MAG2 source code
  122.             MAGNIFY.S  > This is the assembly source code for the
  123.                          magnify routine.  It is fully commented.
  124.                          Both MAG1 and MAG2 use this program.
  125.             READ.ME    > This documentation file.
  126.  
  127. I hope these programs and routine are helpful, enjoy!!!
  128.  
  129.